// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class sample83 : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        sourceCode.Text = @"public void LinqToEntities47()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;var mexico = context.Orders.Where(o => o.ShipCountry == ""Mexico"").Select(o => o);<br>&nbsp;&nbsp;&nbsp;&nbsp;var canada = context.Orders.Where(o => o.ShipCountry == ""Canada"").Select(o => o);<br>&nbsp;&nbsp;&nbsp;&nbsp;var union = mexico.Union(canada).Select(o => o.Employee);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;var query = union.Distinct();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;ObjectDumper.Write(query);<br>}<br>";
    }

    public void ExecuteQuery(object src, EventArgs e)
    {
        using (context = new EntityNorthwind.EntityNorthwindContext(connstr))
        {
            LinqToEntities47();
        }
        this.output.Text = QueryOutput();
    }

	public void LinqToEntities47()
{
    var mexico = context.Orders.Where(o => o.ShipCountry == "Mexico").Select(o => o);
    var canada = context.Orders.Where(o => o.ShipCountry == "Canada").Select(o => o);
    var union = mexico.Union(canada).Select(o => o.Employee);

    var query = union.Distinct();

    ObjectDumper.Write(query);
}

}
